import logging
import os 
from progressbar import * 
import  time  
#从Python SDK导入BOS配置管理模块以及安全认证模块
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
from hashlib import md5 as hash_
file_name=os.path.expanduser('~/AppData/LocalLow/Ludeon Studios/RimWorld by Ludeon Studios/Saves/Autosave-2.rws')

left_size = os.path.getsize(file_name)
# left_size用于设置分块开始位置
# 设置分块的开始偏移位置
offset = 0
file=open(file_name,"rb")
part_number = 1
while left_size > 0:
    # 设置每块为5MB
    part_size = 1024*1024
    if left_size < part_size:
        part_size = left_size

    hash = hash_()
    file.seek(offset+1)
    print(file.tell())
    data = file.read(part_size)
    hash.update(data)
    
    
    print(hash.hexdigest().upper())
   

    left_size -= part_size
    offset += part_size

    #pbar.update(offset)
file.close()